package com.letter.otools.day.todo;

import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.blankj.utilcode.util.TimeUtils;
import com.google.android.material.appbar.MaterialToolbar;
import com.letter.otools.day.BaseActivity;
import com.letter.otools.day.R;

import org.litepal.LitePal;

public class TodoDetailActivity extends BaseActivity {

    private int TodoId = -1;
    private MaterialToolbar toolbar;
    private TextView tvTitle;
    private TextView tvDate;
    private ImageView ivWeather;
    private ImageView ivMood;
    private TextView tvContent;
    private Todo Todo;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        TodoId = getIntent().getIntExtra("TodoId", -1);
        super.onCreate(savedInstanceState);
    }

    @Override
    protected int getLayout() {
        return R.layout.todo_detail;
    }

    @Override
    protected void initView() {
        setSupportToolbarBack(toolbar);
        Todo = LitePal.find(Todo.class, TodoId);
        tvTitle.setText(Todo.getContent());
        tvContent.setText(Todo.getContent());
        tvDate.setText(TimeUtils.millis2String(Todo.getCreateTime()));
    }


    @Override
    public void initBinder() {
        toolbar = findViewById(R.id.toolbar);
        tvTitle = findViewById(R.id.tvTitle);
        tvDate = findViewById(R.id.tvDate);
        ivWeather = findViewById(R.id.ivWeather);
        ivMood = findViewById(R.id.ivMood);
        tvContent = findViewById(R.id.tvContent);
    }
}
